<?php
class Common_func
{
	private $appKey = '21574597';
	private $appSecret = 'fd0ec5b37652fdf39dec20981d81144f';
	private $redirect_uri = 'http://192.168.0.161/index.php/common/getCodeForTb';
	private $oauth;
	public function __construct()
	{
		$this->obj =& get_instance();
		$this->_writeHistory();
		$this->_getOauth();
	}
	public function _getOauth()
	{
		$this->obj->db->select();
		$this->obj->db->where('key','access_token');
		$this->obj->db->or_where('key','refresh_token');
		$data = $this->obj->db->get('oauth')->result_array();
		foreach ($data as $k=>$v)
		{
			$oauth[$v['key']] = $v['val'];
		}
		$this->oauth = $oauth;
	}
	/*
	 * 历史记录cookiss记录**/
	public function _writeHistory()
	{//历史记录
		$history = $this->obj->input->cookie('history', TRUE);
		$urlArray = explode(',', $history);
		if( count($urlArray) > 5)
		{
			$urlArray[] = uri_string();
			unset($urlArray[0]);
			$history = implode(',', $urlArray);
			$this->obj->input->set_cookie(array('name'=>'history','value'=>$history,'expire'=>10000000));
		}
		else
		{
			$this->obj->input->set_cookie(array('name'=>'history','value'=>$history.','.uri_string(),'expire'=>10000000));
		}
	}
	/*
	 * 生成密码加密串**/
	public function createPwd($str)
	{
		$md5Pwd = md5($str);
		return substr($md5Pwd,0,10).substr($md5Pwd,26,6);
	}
	/**
	 * 生成交易密码加密串*/
	public function createTradecode($str)
	{
		$md5Tradecode = md5($str);
		return substr($md5Tradecode,0,4).substr($md5Tradecode,12,4).substr($md5Tradecode,20,4).substr($md5Tradecode,28,4);
	}
	/**
	 * 提示语言，根据参数定义*/
	public function  _getLangArray()
	{
		/*第一个数字代表前端还是后端0：后端，1：前端
		*/
		$data[0][0][2][0][0][0] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-success',
										'tips_title'=>'恭喜！',
										'tips_text'=>'修改个人资料成功.',
										'preUrl' => site_url('member/member_center/editProfile'),
										'dom_show'=>'profile',
									);
		$data[0][0][2][0][1][0] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-success',
										'tips_title'=>'恭喜！',
										'tips_text'=>'密码修改成功，下次登录记得用新密码登录.',
										'preUrl' => site_url('member/member_center/editPassWord'),
										'dom_show'=>'password',
									);
		$data[0][0][2][0][1][1] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-error',
										'tips_title'=>'失败！',
										'tips_text'=>'修改密码失败，请输入正确的原始密码.',
										'preUrl' => site_url('member/member_center/editPassWord'),
										'dom_show'=>'password',
									);
		$data[0][0][2][0][2][0] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-success',
										'tips_title'=>'恭喜！',
										'tips_text'=>'您已经成功设置安全密码，下次支付时需要用安全密码确认支付，请妥善保管.',
										'preUrl' => site_url('member/member_center/editTradecode'),
										'dom_show'=>'tradecode',
									);
		$data[0][0][2][0][2][1] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-success',
										'tips_title'=>'恭喜！',
										'tips_text'=>'安全密码修改成功，请您牢记新的安全密码，以后支付操作新的安全密码将启用.',
										'preUrl' => site_url('member/member_center/editTradecode'),
										'dom_show'=>'tradecode',
									);
		$data[0][0][2][0][2][2] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-error',
										'tips_title'=>'失败！',
										'tips_text'=>'修改安全密码失败，请输入正确的原始安全密码.',
										'preUrl' => site_url('member/member_center/editTradecode'),
										'dom_show'=>'tradecode',
									);
		$data[0][4][2][1][0][0] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-error',
										'tips_title'=>'订单号不能为空！',
										'tips_text'=>'请输入淘宝交易的订单号.',
										'preUrl' => site_url('member/member_center/doAddFinance'),
										'dom_show'=>'tradecode',
									);
		$data[0][4][2][1][0][1] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-error',
										'tips_title'=>'会员名不能为空！',
										'tips_text'=>'请输入淘宝交易的会员名.',
										'preUrl' => site_url('member/member_center/doAddFinance'),
										'dom_show'=>'tradecode',
									);
		$data[0][4][2][1][0][2] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-error',
										'tips_title'=>'验证失败！',
										'tips_text'=>'系统错误，请稍后再试...',
										'preUrl' => site_url('member/member_center/doAddFinance'),
										'dom_show'=>'tradecode',
									);
		$data[0][4][2][1][0][3] = array(
										'type'=>'Alert',
										'alert_class'=>'alert-error',
										'tips_title'=>'充值失败！',
										'tips_text'=>'请提供合法的订单编号或者重新检查订单状态.',
										'preUrl' => site_url('member/member_center/doAddFinance'),
										'dom_show'=>'tradecode',
									);
		return $data;
	}
	/**
	 * 返回相应的提示语言代码*/
	public function returnHtml($parm)
	{
		$pArray = explode('.', $parm);
		$hArray = $this->_getLangArray();
		foreach ($pArray as $k=>$v)
		{
			$hArray = $hArray[$v];
		}
		$history = explode(',', $this->obj->input->cookie('history',true));
		switch ($hArray['type'])
		{
			case 'Alert':
				$dom = '<script>setTimeout(function(){$("#'.$hArray['dom_show'].'").addClass("active").siblings().removeClass("active");$("#'.$hArray['dom_show'].'_tab").addClass("active").siblings().removeClass("active");});</script>';;
				if(substr_count($hArray['preUrl'],$history[5]) == 0)
				{
				}
				else
				{
					$dom .= '<script>setTimeout(function(){$(\'.alert\').remove();},5000);</script><div class="alert '.$hArray['alert_class'].'"><button type="button" class="close" data-dismiss="alert">×</button><strong>'.$hArray['tips_title'].'</strong> '.$hArray['tips_text'].'</div>';
				}
				break;
		}
		return $dom;
	}
	/*
	 * 所有全局变量**/
	function siteGlobal()
	{
		$data = array(
					'prince'=>array(
								0=>3.5,
								1=>null,
								2=>0.1,
					),
					'page'=>array(
								'per_page'=>'10',
								'num_links'=>'2',
					),
		);
		return $data;
	}
	/**
	 * 检测是否是淘宝订单号，且返回金额等信息*/
	public function isTbOrder($data)
	{
		$this->obj->db->select();
		$this->obj->db->where('tb_order.order_number',$data['tb_order_no']);
		$this->obj->db->join('user','user.id=tb_order.user_id');
		$orderData = $this->obj->db->get('tb_order')->result_array();
		if(count($orderData) > 0)
		{
			$reData = array('code'=>-2,'info'=>array(
										'tips_img'=>'img/alert.gif',
										'tips_text'=>'<span style="color: rgb(241, 132, 31);">充值失败：订单号已经失效！！！.</span><span>该订单号&lt;'.$data['tb_order_no'].'&gt;在'.date('Y-m-d H:i:s',$orderData[0]['out_time']).'已被用户&lt;'.$orderData[0]['user'].'&gt;使用...</span>',
						));
		}
		else
		{
			$orderInfo = $this->getOrderInfoForId($data['tb_order_no']);//订单信息
			if(isset($orderInfo->error_response))
			{
				$reData = array('code'=>0,'msg'=>$orderInfo->error_response->sub_msg);
			}
			else if(isset($orderInfo->trade_get_response))
			{
				if($orderInfo->trade_get_response->trade->buyer_nick == $data['tb_order_name'] && $orderInfo->trade_get_response->trade->seller_nick == '信购小淘' )
				{
					switch ($orderInfo->trade_get_response->trade->status)
					{
						case 'TRADE_CLOSED':
						case 'TRADE_CLOSED_BY_TAOBAO':
						case 'TRADE_NO_CREATE_PAY':
						case 'WAIT_BUYER_PAY':
						case 'SELLER_CONSIGNED_PART':
							$reData = array('code'=>0,'msg'=>'该订单状态不能为账户充值');
							break;
						case 'WAIT_SELLER_SEND_GOODS':
						case 'WAIT_BUYER_CONFIRM_GOODS':
							$reData = array('code'=>1,'data'=>array('order_number'=>$data['tb_order_no'],'order_name'=>$data['tb_order_name'],'prince'=>$orderInfo->trade_get_response->trade->received_payment,'is_ok'=>0));
							break;
						case 'TRADE_FINISHED':
							$reData = array('code'=>1,'data'=>array('order_number'=>$data['tb_order_no'],'order_name'=>$data['tb_order_name'],'prince'=>$orderInfo->trade_get_response->trade->received_payment,'is_ok'=>1));
							break;
					}
				}
				else
				{
					$reData = array('code'=>0,'msg'=>'非法操作，请提供合法订单号码');
				}
			}
			else
			{
				$reData = array('code'=>-1,'msg'=>'系统错误，请稍后再试！！！');
			}
		}
		return $reData;
	}
	/**
	 * 分页显示*/
	public function getPage($data)
	{
		$data['dom'] = '';
		$pageNum = ceil($data['total_rows']/$data['per_page']);
		if($pageNum > 1)
		{
			if($data['now_page'] == 1)
			{
				$data['dom'] .= '<div class="btn-group">';
			}
			else
			{
				$data['dom'] .= '<div class="btn-group"><a class="btn" href="'.site_url("member/order_center/index/1").'">第一页</a></div><div class="btn-group"><a class="btn" href="'.site_url("member/order_center/index/".($data["now_page"]-1)).'">上一页</a>';
			}
			$bg = ($data['now_page']-$data['num_links'] <= 0)?1:$data['now_page']-$data['num_links'];
			$end = ($data['now_page']+$data['num_links'] >= $data['total_rows']/$data['per_page'])?$data['total_rows']/$data['per_page']:$data['now_page']+$data['num_links'];
			for($i=$bg;$i<=$end+1;$i++)
			{
				if($i !=$data['now_page'])
				{
					$data['dom'] .= '<a class="btn" href="'.site_url("member/order_center/index/".$i).'">'.$i.'</a>';
				}
				else
				{
					$data['dom'] .= '<a class="btn" href="'.site_url("member/order_center/index/".$i).'" disabled>'.$i.'</a>';
				}
			}
			if($data['now_page'] == $pageNum)
			{
				$data['dom'] .= '</div>';
			}
			else
			{
				$data['dom'] .= '<a class="btn" href="'.site_url("member/order_center/index/".($data["now_page"]+1)).'">下一页</a></div><div class="btn-group"><a class="btn" href="'.site_url("member/order_center/index/".$pageNum).'">最后一页</a></div>';
			}
		}
		return $data['dom'];
	}
	function readerExcel($filePath)
	{
		require_once 'plug/PHPExcel/PHPExcel.php';
		$siteFlobal = $this->siteGlobal();
		$PHPExcel = new PHPExcel();
		$PHPReader = new PHPExcel_Reader_Excel2007();
		if(!$PHPReader->canRead($filePath)){
			$PHPReader = new PHPExcel_Reader_Excel5();
			if(!$PHPReader->canRead($filePath)){
			return array();
			exit ;
			}
		}
		$PHPExcel = $PHPReader->load($filePath);
		/**读取excel文件中的第一个工作表*/
		$currentSheet = $PHPExcel->getSheet(0);
		/**取得最大的列号*/
		$allColumn = $currentSheet->getHighestColumn();
		/**取得一共有多少行*/
		$allRow = $currentSheet->getHighestRow();
		/**从第二行开始输出，因为excel表中第一行为列名*/
		if($allColumn == 'A')
		{
			for($currentRow = 1;$currentRow <= $allRow;$currentRow++){
			/**从第A列开始输出*/
				for($currentColumn= 'A';$currentColumn<= $allColumn; $currentColumn++){
					$val = $currentSheet->getCellByColumnAndRow(ord($currentColumn) - 65,$currentRow)->getValue();/**ord()将字符转为十进制数*/
	//				$val = iconv('utf-8','gb2312', $val);
					$data[] = $val;
				}
			}
		}
		else
		{
			for($currentRow = 3;$currentRow <= $allRow;$currentRow++){
			/**从第A列开始输出*/
				$post_address = '';
				$my_address = '';
				for($currentColumn= 'A';$currentColumn<= $allColumn; $currentColumn++){
					$val = $currentSheet->getCellByColumnAndRow(ord($currentColumn) - 65,$currentRow)->getValue();/**ord()将字符转为十进制数*/
	//				$val = iconv('utf-8','gb2312', $val);
					$data[$currentRow]['prince'] = $siteFlobal['prince'][0];
					$data[$currentRow]['my_address_type'] = -1;
					switch ($currentColumn)
					{
						case 'A':
							$data[$currentRow]['post_province'] = $val;
							$post_address .= ' '.$val;
							break;
						case 'B':
							$data[$currentRow]['post_city'] = $val;
							$post_address .= ' '.$val;
							break;
						case 'C':
							$data[$currentRow]['post_area'] = $val;
							$post_address .= ' '.$val;
							break;
						case 'D':
							$data[$currentRow]['post_street'] = $val;
							$post_address .= ' '.$val;
							break;
						case 'E':
							$data[$currentRow]['post_name'] = $val;
							break;
						case 'F':
							$data[$currentRow]['post_tel'] = $val;
							$data[$currentRow]['post_address'] = $post_address;
							break;
						case 'G':
							$data[$currentRow]['my_province'] = $val;
							$my_address .= ' '.$val;
							break;
						case 'H':
							$data[$currentRow]['my_city'] = $val;
							$my_address .= ' '.$val;
							break;
						case 'I':
							$data[$currentRow]['my_name'] = $val;
							$data[$currentRow]['my_address'] = $my_address;
							break;
					}
				}
			}
		}
		return $data;
	}
	function writeExcel($orderData)
	{
		require_once 'plug/PHPExcel/PHPExcel.php';
		$objExcel = new PHPExcel();
		$objWriter = new PHPExcel_Writer_Excel2007($objExcel); // 用于 2007 格式
		$objWriter->setOffice2003Compatibility(true);
		$objExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(25);
		$objExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(30);
		$objExcel->getActiveSheet()->getRowDimension('2')->setRowHeight(30);
		$objExcel->setActiveSheetIndex(0);
		$objActSheet = $objExcel->getActiveSheet();
		$objActSheet->setTitle('Sheet1');
		$objActSheet->setCellValue('A1', '请填写正确');
		$objActSheet->setCellValue('B1', '发货地址');
		$objActSheet->setCellValue('E1', '收货地址');

		$objActSheet->setCellValue('A2', '快递单号');
		$objActSheet->setCellValue('B2', '发货省份');
		$objActSheet->setCellValue('C2', '发货城市/区');
		$objActSheet->setCellValue('D2', '发货人姓名');
		$objActSheet->setCellValue('E2', '收货地址');
		$objActSheet->setCellValue('F2', '收货人');
		$objActSheet->setCellValue('G2', '电话');
		$num = 0;
		foreach($orderData as $k=>$v)
		{
			$num++;
			$t = $k+3;
			$objActSheet->setCellValue('A'.$t, $v['post_number']);
			$objActSheet->setCellValue('B'.$t, $v['my_province']);
			$objActSheet->setCellValue('C'.$t, $v['my_city']);
			$objActSheet->setCellValue('D'.$t, $v['my_name']);
			$objActSheet->setCellValue('E'.$t, $v['post_address']);
			$objActSheet->setCellValue('F'.$t, $v['post_name']);
			$objActSheet->setCellValue('G'.$t, $v['post_tel']);
		}
		$objActSheet->getColumnDimension('A')->setWidth(20);
		$objActSheet->getColumnDimension('B')->setWidth(20);
		$objActSheet->getColumnDimension('C')->setWidth(20);
		$objActSheet->getColumnDimension('D')->setWidth(20);
		$objActSheet->getColumnDimension('E')->setWidth(50);
		$objActSheet->getColumnDimension('F')->setWidth(20);
		$objActSheet->getColumnDimension('G')->setWidth(20);
		$array = array('A','B','C','D','E','F','G');
		for ($i=1;$i<$num+3;$i++)
		{
			foreach($array as $k=>$v)
			{
				$objStyle = $objActSheet->getStyle($v.$i);
				if($i < 3)
				{
					$objFill = $objStyle->getFill();
					$objFill->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
					switch ($v.$i)
					{
						case 'A1':
						case 'A2':
							$objFill->getStartColor()->setARGB('ff0000');
							break;
						case 'B1':
						case 'B2':
						case 'C2':
						case 'D2':
							$objFill->getStartColor()->setARGB('ffff00');
							break;
						case 'E1':
						case 'E2':
						case 'F2':
						case 'G2':
							$objFill->getStartColor()->setARGB('ffcc00');
							break;
					}
				}
				$objBorder = $objStyle->getBorders();
				$objBorder->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
				$objBorder->getTop()->getColor()->setARGB('000000'); // color
				$objBorder->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
				$objBorder->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
				$objBorder->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

				$objAlign = $objStyle->getAlignment();
				$objAlign->setHorizontal(PHPExcel_Style_Alignment::VERTICAL_CENTER);
				$objAlign->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
			}
		}
		$objActSheet->mergeCells('E1:G1');
		$objActSheet->mergeCells('B1:D1');
		//从指定的单元格复制样式信息.
//		$objActSheet->duplicateStyle($objStyleA5, 'B1:C22');
//		//保护单元格
//		$objExcel->getSheet(1)->getProtection()->setSheet(true);
//		$objExcel->getSheet(1)->protectCells('A1:C22', 'PHPExcel');
		$outputFileName = 'download/download-'.time().".xls";
		//到文件
		$objWriter->save($outputFileName);
		return $outputFileName;
	}
	function getArea($data)
	{
		foreach ($data as $k=>$v)
		{
			$this->obj->db->select();
			$this->obj->db->where($k.'ID',$v);
			$sqlData = $this->obj->db->get($k)->result_array();
			$data[$k] = $sqlData[0][$k];
		}
		return $data;
	}
	function queryPostInfo($number)
	{
		$info = file_get_contents('http://122.225.104.195:8089/SearchScanInfoInterface/searchCode.do?billcode='.$number);
		$info = iconv('GBK','UTF-8',$info);
		$info = explode('<table',$info);
		unset($info[0]);
		if(substr_count($info['2'], 'tr') > 2)//有记录
		{
			$n = 0;
			$info = explode('td', $info['2']);
			for ($i=7;$i<count($info);$i+=2)
			{
				$data['info'][$n]['number'] = trim($info[$i],'></ ');
				$i += 2;
				$data['info'][$n]['do_time'] = trim($info[$i],'></ ');
				$i += 2;
				$a = trim($info[$i],'></ ');
				$data['info'][$n]['info'] = ($a[0] == 'b')?'<'.$a:$a;
				$n++;
			}
			$data['static'] = (substr_count($data['info'][$n-1]['info'], '派件已【签收】') > 0)?1:0;
		}
		else
		{
			$data['info'] = -1; //没有记录
			$data['static'] = 0;
		}
		if ($data['static'] == 1)//如果物流签收
		{
			$this->obj->db->where('post_number',$number);
			$this->obj->db->update('addorder',array('post_static'=>1));//更新子订单为签收状态
			//处理总订单状态
			$this->obj->db->select('order.static,addorder.order_id');
			$this->obj->db->join('addorder','addorder.order_id=order.order_id');
			$this->obj->db->where('addorder.post_number',$number);
			$this->obj->db->where('order.shop_type',0);
			$orderData = $this->obj->db->get('order')->result_array();//找到指定订单
			
			if($orderData[0]['static'] == 1) //总订单状态为未完成，如果完成不需要处理
			{
				$this->obj->db->select();
				$this->obj->db->where('order_id',$orderData[0]['order_id']);
				$this->obj->db->where('post_static',0);
				if($this->obj->db->get('addorder')->num_rows() < 1)//如果没有未完成的子订单，则设置订单状态为已完成（包括未完成的和申请底单的）
				{
					$this->obj->db->where('order_id',$orderData[0]['order_id']);
					$this->obj->db->update('order',array('static'=>2));
				}
			}
		}
		else //物流未签收，直接修改子订单为为完成
		{
			$this->obj->db->where('post_number',$number);
			$this->obj->db->update('addorder',array('post_static'=>0));
		}
		return $data;
	}
	public function publicView($data)
	{
		$this->obj->load->view('member/public/head',$data);
		$this->obj->load->view('member/public/left');
		$this->obj->load->view('member/public/pay_result');
		$this->obj->load->view('member/public/foot');
	}
	public function HttpRequest($data)
	{
		$url = $data['url'];
		if($data['method'] == 'get')
		{
			$url .= '?'.http_build_query($data['paramet']);
		}
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_FAILONERROR, false);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

		if($data['method'] == 'post')
		{
			curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
	 		curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data['paramet']));
		}
		$reponse = curl_exec($ch);
		if (curl_errno($ch)){
			throw new Exception(curl_error($ch),0);
		}
		else{
			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
			if (200 !== $httpStatusCode){
				throw new Exception($reponse,$httpStatusCode);
			}
		}
		curl_close($ch);
		return $reponse;
	}
	public function oauthTb()
	{
		$data['url'] = 'https://oauth.taobao.com/authorize';
		$data['method'] = 'get';
		$data['paramet'] = array('client_id'=>$this->appKey,'response_type'=>'code','redirect_uri'=>$this->redirect_uri,'state'=>1);
		redirect('https://oauth.taobao.com/authorize?'.http_build_query($data['paramet']), 'location', 303);
	}
	public function getAccessToken($code)
	{
		$data['url'] = 'https://oauth.taobao.com/token';
		$data['method'] = 'post';
		$data['paramet'] = array(
							'client_id'=>$this->appKey,
							'client_secret'=>$this->appSecret,
							'grant_type'=>'authorization_code',
							'code'=>$code,
							'redirect_uri'=>$this->redirect_uri,
		);
		return $this->HttpRequest($data);
	}
	public function refreshAccessToken()
	{
		$data['url'] = 'https://oauth.taobao.com/token';
		$data['method'] = 'post';
		$data['paramet'] = array(
							'client_id'=>$this->appKey,
							'client_secret'=>$this->appSecret,
							'grant_type'=>'refresh_token',
							'refresh_token'=>$this->oauth['refresh_token'],
		);
		$reData = json_decode($this->HttpRequest($data));
		$access_token = $reData->access_token;
		$refresh_token = $reData->refresh_token;
		$this->obj->db->where('key','access_token');
		$this->obj->db->update('oauth',array('val'=>$access_token));

		$this->obj->db->where('key','refresh_token');
		$this->obj->db->update('oauth',array('val'=>$refresh_token));

		$this->db->where('key','refresh_time');
		$this->db->update('oauth',array('val'=>time()));
		echo '授权成功';
	}
	public function getOrderInfoForId($order_id)
	{
		$data['url'] = 'https://eco.taobao.com/router/rest';
		$data['method'] = 'post';
		$data['paramet'] = array(
								'method'=>'taobao.trade.get',
								'access_token'=>$this->oauth['access_token'],
								'format'=>'json',
								'v'=>'2.0',
								'fields'=>'status,buyer_nick,seller_nick,received_payment,available_confirm_fee,num_iid',
								'tid'=>$order_id,
		);
		$orderInfo = json_decode($this->HttpRequest($data));
		return $orderInfo;
	}
}